package movie;

public class Rental {


	private Movie _movie;
	private int _dayRented;
	
	public Rental(Movie movie, int _dayRented) {
		super();
		this._movie = movie;
		this._dayRented = _dayRented;
	}
	public double getCharge(){
		double thisAmount = 0;
		switch (getMovie().get_priceCode()) {
		case Movie.REGULAR:
			thisAmount += 2;
			if (getdayRented() > 2) {
				thisAmount += (getdayRented() - 2) * 1.5;
			}
			break;
		case Movie.NEW_release:
			thisAmount += getdayRented()*3;
		break;
		case Movie.CHILDRENS:
			thisAmount += 1.5;
			if (getdayRented() > 3) {
				thisAmount += (getdayRented() - 3) * 1.5;
			}
		break;
		
		default:
			break;
		}
		return thisAmount;
	}
	
	public int getFrequentRenterPoints(){
		if ((getMovie().get_priceCode() == Movie.NEW_release) && getdayRented() > 1) {
			return 2;
		}else {
			return 1;
		}
	}
	

	public Movie getMovie() {
		return _movie;
	}

	public int getdayRented() {
		return _dayRented;
	}
	
	
}
